/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package controller.action;

import java.io.IOException;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import model.database.SqlFolder;
import model.entities.Account; 

/**
 *
 * @author THANH
 */
public class CreateFolder implements Action{

    public void exe(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException {
        HttpSession sesion = request.getSession();
        Account account = (Account) sesion.getAttribute("Account");
        String title = request.getParameter("txtFolderTitle") ;
        SqlFolder sqlFolder = new SqlFolder();
        int status = sqlFolder.createFolder(account, title);
        account.setListFolders(sqlFolder.getListFolder(account));
        sesion.setAttribute("Account", account);
        request.getRequestDispatcher("index.jsp").forward(request, response);
    }
}
